package org.coc.iot.service;


import java.util.Map;

import org.coc.iot.common.page.PageList;
import org.coc.iot.common.page.PageProperty;
import org.coc.iot.common.utils.PageUtil;
import org.coc.iot.entity.SysUser;
import org.coc.iot.mapper.SysUserMapper;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;


/**
 * @Description:实现类
 * @author 
 * @version 1.0
 * @created 
 */
@Service
public class SysUserService extends BaseService<SysUser, SysUserMapper> implements InitializingBean {

	@Autowired
	private SysUserMapper sysUserMapper;
	
	public void afterPropertiesSet() throws Exception {
		this.setBaseMapper(sysUserMapper);
	}

	/**
	 *
	 * @param pp
	 * @return
	 */
	public PageList<Map<String, Object>> getUserInfoPageList(PageProperty pp) {
		int count = sysUserMapper.getUserInfoCount(pp.getParamMap());
		int start = PageUtil.getStart(pp.getNpage(), count, pp.getNpagesize());
		int end = PageUtil.getEnd(pp.getNpage(), count, pp.getNpagesize());
		pp.putParamMap("startrow", start);
		pp.putParamMap("endrow", end);
		pp.putParamMap("pagesize", pp.getNpagesize());
		PageList<Map<String,Object>> pageList = new PageList<Map<String,Object>>(pp, count, sysUserMapper.getUserInfoSplitList(pp.getParamMap()));
		return pageList;
	}

}
